<template>
  <div>
    <div class="return" >
      <a-icon type="left"  @click="$router.back()"/>
    </div>

    <div class="content" v-for="(item, index) in detailList" :key="index">
      <div class="banner">
        <a-carousel autoplay>
          <div><img :src="item.img" alt="" /></div>
          <div><img :src="item.img1" alt="" /></div>
          <div><img :src="item.img2" alt="" /></div>
          <div><img :src="item.img3" alt="" /></div>
        </a-carousel>
      </div>
      <p class="price">
        ￥<span>{{ item.price / 100 }}</span>
      </p>
      <p class="title">
        <b>{{ item.name }}</b>
      </p>
      <p class="tag">{{ item.content }}</p>
      <label>{{ item.transport }}</label>
      <p class="explain">
        <span>配送</span><span>预计1-4天送达，第三方物流配送，包邮</span>
      </p>
    </div>
    <div>
      <p class="nav">推荐商品</p>
      <div class="recommend-all">
        <div class="recommend" v-for="(item,index) in recommendList" :key="index">
          <img :src="item.img" alt="" />
          <p><b>{{item.name}}</b></p>
          <label>{{item.transport}}</label>
          <div>
            <span>￥{{item.price}}</span>
            <a-icon type="plus-circle" />
          </div>
        </div>
      </div>
    </div>
    <detail-foot></detail-foot>  
  </div>
</template>

<script>
import DetailFoot from '../components/DetailFoot.vue';
export default {
  components: { DetailFoot },
  data() {
    return {
      detailList: [], //商品信息
      recommendList:[],//推荐商品
    };
  },
  methods: {
     
  },
  mounted() {
    this.$http
      .get("/work/box-horse/freshdetail.php", {
        params: {
          id: this.$route.query.id,
        },
      })
      .then((res) => {
        this.detailList = res.data.data;
      })
      .catch((err) => {});
      
     this.$http
      .get("/work/box-horse/recommend.php", {
        params: {
          id: this.$route.query.id,
        },
      })
      .then((res) => {
        this.recommendList = res.data.data;
      })
      .catch((err) => {});
  },
};
</script>
<style lang="scss" scoped>
.return {
  position: absolute;
  left: 10px;
  top: 10px;
  font-size: 20px;
  color: rgba(153, 153, 153, 1);
  z-index: 999;
}
/* 轮播图*/
.ant-carousel >>> .slick-slide {
  text-align: center;
  height: 160px;
  line-height: 160px;
  background: #364d79;
  overflow: hidden;
}
.ant-carousel >>> .slick-slide h3 {
  color: #fff;
}

.banner img {
  width: 100%;
  height: 300px;
}
.price {
  color: #FF6347;
  font-size: 20px;
}
.title {
  font-size: 20px;
}
.tag {
  font-size: 10px;
  color: rgb(185, 179, 179);
}
.content{
    position: relative;
}
.content label {
  border-radius: 5px;
  background-color: #ead7d7;
}
.explain span:last-child {
  margin-left: 10px;
}
.explain {
  margin-top: 5px;
}
.recommend img {
  width: 100px;
  height: 150px;
  margin-left:10px;
}
.recommend p {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 5px;
}
.recommend {
 
  border: 1px solid lightgray;
  border-radius: 10px;
   width: 40%;
  height: 240px;
  margin-top:10px;
  margin-left:10px;
  margin-right: 10px;
}
.recommend label {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  border-radius: 10px;
  font-size: 3px;
  border: 1px solid #ff9933;
  color: #ff9933;
  width: 100px;
}
.recommend span {
  color: #FF6347;
}
.recommend i {
  float: right;
  font-size: 20px;
}
.recommend-all {
  display: flex;
  border-radius: 10px;
  background-color: #fff;
  flex-wrap: wrap;
  flex-grow: 2;
  justify-content: space-between;
}
.nav{
    color:$font-color;
    font-size: 20px;
}
</style>